package com.dvdfe8.crochet.controlador;

import com.dvdfe8.crochet.modelo.service.ClienteService;
import com.dvdfe8.crochet.modelo.service.PedidoService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author David
 */
@Controller

public class HomeController {    
    
    @Autowired
    PedidoService pedidoService;

    
    @RequestMapping(value = {"/home"}, method = RequestMethod.GET)
    public ModelAndView showHomePage(){
        ModelAndView mav = new ModelAndView("home");
        List pedidos= pedidoService.listarTodos();
        mav.addObject("pedidos",pedidos);
        return mav;
    }
}
